<?php 
defined('IN_TS') or die('Access Denied.');

$page = isset($_GET['page']) ? intval($_GET['page']) : 1;

$lstart = $page*30-30;

$typeid = intval($_GET['typeid']);

$arr = array('isaudit'=>0);

if($typeid){
    $arr['typeid'] = $typeid;
}

$url = tsUrl('task','index',array('typeid'=>$typeid,'page'=>''));

//全部任务
$arrTask = $new['task']->findAll('task',$arr,'isrecommend desc,addtime desc',null,$lstart.',30');

foreach($arrTask as $key=>$item){

    $arrTask[$key]['title']=tsTitle($item['title']);
    $arrTask[$key]['user'] = aac('user')->getOneUser($item['userid']);
    $arrTask[$key]['type'] = aac('task')->getType($item['typeid']);
}

$taskNum = $new['task']->findCount('task',$arr);

$pageUrl = pagination($taskNum, 30, $page, $url);

$title = '任务';
include template("index");